a=7*5**123+6*5**111-5*25**50+4*125**30-3*5**10
k=0
while a>0:
    if a%5==4:
        k+=1
    a=a//5
print(k)